<?php
class Login extends CI_Controller{
    public function __construct(){
        parent::__construct();
		$this->load->library('session');
		$this->load->helper(array('form', 'url')); 
    }
    public function index(){
		$login['view'] = "frontend/login";
		$username = $this->input->get('Username');
		$pass = $this->input->get('Password');
		if(isset($username)&&isset($pass))
		{
			$login['kq'] = json_decode(file_get_contents('http://egov047.juddy.vn/api/Accounts/login?userName='.$username.'&pass='.$pass),true);
			if($login['kq']!=0)
			{
				$login['user'] = array(json_decode(file_get_contents('http://egov047.juddy.vn/api/user/getbyid?userid='.$login['kq']),true));
				$this->session->set_userdata('login',$login['user']);
				$this->session->userdata('login');
			}
		}
		$this->load->view('frontend/content', $login);
    }
}
?>